﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Inpinke.BLL;
using Inpinke.Model;

namespace inpinke.com.Controllers
{
    public class InPinController : Controller
    {
        //
        // GET: /InPin/

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Compare()
        {
            return View();
        }

        public ActionResult PriceList()
        {
            return View();
        }

        public ActionResult DealRecorder()
        {
            return View();
        }

        /// <summary>
        /// 制作印品
        /// </summary>
        /// <param name="prodid"></param>
        /// <returns></returns>
        public ActionResult Create(string prodcode)
        {
            if (string.IsNullOrEmpty(prodcode))
            {
                ViewBag.Msg = "访问出错，链接地址不正确。";
                return View("error");
            }

            Inpinke_Product p = DBProductBLL.GetProductByCode(prodcode);
            if (p == null)
            {
                ViewBag.Msg = "对不起，该印品尚未开放定制";
                return View("error");
            }
            if (prodcode.ToLower() == "intime")
            {
                return RedirectToAction("createintime", "intime", new { prodid = p.ID });
            }
            else if (prodcode.ToLower() == "inway")
            {
                return RedirectToAction("createinway", "inway", new { prodid = p.ID });
            }
            else
            {
                ViewBag.Msg = "对不起，该印品尚未开放定制";
                return View("error");
            }
        }

    }
}
